package com.he.architecture.controller;

import com.he.architecture.common.controller.LogicController;
import com.he.architecture.dao.ShopItemDao;
import com.he.architecture.dto.ResponseResult;
import com.he.architecture.entity.Item;
import com.he.architecture.entity.ShopItem;
import com.he.architecture.service.BusinessService;
import com.he.architecture.service.ShopItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/shopItem")
public class ShopItemController extends LogicController<ShopItemService, ShopItemDao, ShopItem,Long> {
    public ShopItemController(@Autowired ShopItemService service){
        super(service);
    }
    @GetMapping("/getShopItemsByBusiness_Id")
    public ResponseResult getShopItemsByBusiness_Id(@RequestParam("bus_id") Long bus_id) {
        List<ShopItem> shopItems = getService().getShopItemsByBusiness_Id(bus_id);
        Map<String,Object> map=new HashMap<>();
        map.put("shopItems",shopItems);
        return new ResponseResult(200,map);
    }
}
